package Day04;

import java.util.Scanner;

public class Homewok {
    public static void main(String[] args) {
        /*
        // CommandBySwitch命令解析程序：接收用户输入的命令，依据命令做不同的操作
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入功能：1.存款 2.取款 3.查询余额 4.退卡");
        int command = scan.nextInt();
        switch (command) {
            case 1:
                System.out.println("存款");
                break;
            case 2:
                System.out.println("取款");
                break;
            case 3:
                System.out.println("查询余额");
                break;
            case 4:
                System.out.println("退卡");
                break;
            default:
                System.out.println("输入错误");
        }
        //Guessing猜数字之while版：随机生成一个数，由用户来猜，猜不对则反复猜，并给出大小提示， 猜对的则结束，用while来实现。
        Scanner num = new Scanner(System.in);
        int a = (int) (Math.random() * 1000 + 1);
        System.out.println("guess");
        int guess = num.nextInt();
        while (guess != a) {
            if (guess>a){
                System.out.println("猜大了");
            } else  {
                System.out.println("猜小了");
            }
            System.out.println("猜吧");
            guess = num.nextInt();
        }
        System.out.println("猜对了");*/

        //Guessing猜数字之do...while版：随机生成一个数，由用户来猜，猜不对则反复猜，并给出大小提 示，猜对的则结束，用do...while来实现。
       /* Scanner scan = new Scanner(System.in);
        int num = (int) (Math.random() * 1000 + 1);
        int guess;
        do {
            System.out.println("guess");
            guess = scan.nextInt();
            if (guess < num) {
                System.out.println("大了");
            } else if (guess > num) {
                System.out.println("小了");
            } else {
                System.out.println("猜对了");
            }
        } while (guess != num);*/


        //for循环：输出5次"行动是成功的阶梯"、输出9的乘法表(1到9、1/3/5/7/9、9到1)、累加1到100的
       /* for (int times = 0; times < 5; times++) {
            System.out.println("行动是成功的阶梯");
        }
        System.out.println("继续执行");

        for (int num = 1; num <= 9; num++) {
            System.out.println(num + "*9=" + num * 9);
        }
        for (int num = 1; num <= 9; num += 2) {
            System.out.println(num + "*9=" + num * 9);
        }
        for (int num = 9; num >= 1; num--) {
            System.out.println(num+"*9="+num*9);
        }
        //接收用户输入的一个整数num，判断它的正负零值，正数则输出"+"，负数则输出"-"，0则输出"0"
        Scanner scan = new Scanner(System.in);
        System.out.println("输入一个整数");
        int num = scan.nextInt();
        if (num>0){
            System.out.println("+");
        }else if (num<0){
            System.out.println("-");
        }else {
            System.out.println("0");
        }*/

/*
        // 接收用户输入的年份year和月份month，计算该年该月的天数，并输出
        Scanner s = new Scanner(System.in);
        System.out.println("输入一个年份");
        int year = s.nextInt();
        System.out.println("请输入一个月份");
        int month = s.nextInt();
        int days = 0;
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                days = 31;
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                days=30;
                break;
            case 2:
                if ((year % 4 == 0&&year%100==0) || (year%400==0)){
                    days = 29;
                }else {
                    days = 28;
                }

        }
        System.out.println(year+"年的"+month+"月共"+days+"天");

*/



        // 输出1900到2023年之间所有的闰年(每够10个年份，换一行)
        int count = 0;
        for (int year = 1900;year <=2023;year++ ){
            if ((year%4==0&&year%400!=0)||year%400==0){
                System.out.println(year +" ");
                count++;
                if (count % 10 ==   0){
                    System.out.println();
                }
            }
        }

























    }


}

